package code15Lambda表达式;

import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;

/**
 * @author 黄衡熙
 * @version 1.0
 */
public class Test07_方法构造 {
    public static void main(String[] args) {
        // 调用无参构造方法
        Supplier<User> s = User::new;
        User user = s.get();
        // 上述代码相当于new User()
        System.out.println(user);

        // 调用一个参数的构造方法
        Function<Integer,User> f = User::new;
        User user2 = f.apply(1);
        System.out.println(user2);

        // 调用两个参数的构造方法
        BiFunction<Integer,String,User> bf = User::new;
        User user3 = bf.apply(2,"admin");
        System.out.println(user3);
    }
}
